#!/bin/bash
# Job yaml can send below ENVIRONMENT VARIABLES to me
# - branch 
# END ENVIRONMENT VARIABLES

# make KunPengdevBoard image


. $LKP_SRC/lib/debug.sh
. $LKP_SRC/lib/upload.sh
. $LKP_SRC/lib/job.sh

dest_dir="/rpm/upload/${os}-${os_version}/${_custom_repo_name}"
rpmdev_dir="/home/lkp/rpmbuild"
rpm_dest="${dest_dir}/${os_arch}/Packages"
src_rpm_dest="${dest_dir}/source/Packages"
load_job_vars result_root 

declare -a reverse_depends
die()
{
	echo "$@"
	exit 99
}

build_image()
{
	echo "======start build_image========"
	sudo date
	curr_dir=$(pwd)
	export RUN_MODE=CI

	cat /etc/os-release
	uname -a

	cd ${curr_dir}
	sudo rm -rf KunPengDevBoard-Build
	git clone https://gitee.com/kunpeng_compute/KunPengDevBoard-Build.git
	cd KunPengDevBoard-Build
	sudo sh build.sh

	cd ${curr_dir}
}

upload_file()
{
	echo "$@"
	echo "$@" > ./log_image
	upload_one_curl ./log_image ${result_root}
}

build_image
upload_file "test it"

exit 0
